﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Collections.Generic;

 

public partial class frmNavigation : PageBase
{

    protected StringBuilder strNavigation = new StringBuilder();

    protected void Page_Load(object sender, EventArgs e)
    {
        //this._lstNavigation = new List<spGetNavigationByRoleIDResult>();

        if (!IsPostBack)
        {
            //string userid = Session[SessionType.UserName].ToString().Trim();    //用户名

            //RolePurviewBL userbl = new RolePurviewBL();
            //List<ROLEPURVIEW> purviews = userbl.GetPurviewByUser(userid);       //获取用户权限
            //if(purviews==null)
            //    purviews = userbl.GetPurviewByUser("CARGO");                    //无权限赋权默认权限

            //ModuleBL db = new ModuleBL();
            //List<PMODULE> pmodule = db.GetAllPModule();                       //获取所有系统主模块

            //DataTable tblNavigation = new DataTable();
            //tblNavigation.Columns.Add("A");
            //tblNavigation.Columns.Add("B");

            ////遍历系统分组
            //foreach (PMODULE query in pmodule)
            //{
            //    string groupref = query.PMREF.Trim();                            //分组流水号

            //    List<CMODULE> var = db.GetCModuleByPmref(groupref);

            //    if (IsAllHidden(var, purviews))
            //        continue;

            //在页面上生成系统分组
            strNavigation.Append("<div class='Block'>");
            strNavigation.Append("<div class='list_menu_title'>");
            strNavigation.Append("<div class='listA'>");
            strNavigation.Append("<a href = '#'>业务操作</a>");    //分组名称
            strNavigation.Append("</div>");
            strNavigation.Append("</div>");
            strNavigation.Append("<div class='functionsList'>");

            //    //遍历系统子模块
            //    foreach (CMODULE p in var)
            //    {
            //        if (purviews == null || purviews.Where(n => n.CMREF == p.CMREF).Count() < 1)
            //            continue;

            string target = "GenericListContent";
            string url = "TxOut/ctnout.aspx";

            //在页面上生成功能节点
            strNavigation.Append("<div class='list_menu_list'>");
            strNavigation.Append("<img src=../Images/bullet_blue_small.png class=box />");
            strNavigation.Append("<a onclick='setURL(this)' class='TreeNode' target='" + target + "' href = " + (Request.ApplicationPath == "/" ? "" : Request.ApplicationPath) + "/" + url + " tag = ''>提箱补录</a>");
            strNavigation.Append("</div>");

            //        tblNavigation.Rows.Add(new object[] { Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf(Request.ApplicationPath) + Request.ApplicationPath.Length + 1) + p.URL, query.PMODULENM + " - " + p.MODULENM });
            //    }
            strNavigation.Append("</div>");
            strNavigation.Append("</div>");
            //}

            //Session[SessionType.CurrentSiteTable] = tblNavigation;



            strNavigation.Append("<div class='Block'>");
            strNavigation.Append("<div class='list_menu_title'>");
            strNavigation.Append("<div class='listA'>");
            strNavigation.Append("<a href = '#'>查询统计</a>");    //分组名称
            strNavigation.Append("</div>");
            strNavigation.Append("</div>");
            strNavigation.Append("<div class='functionsList'>");

            //    //遍历系统子模块
            //    foreach (CMODULE p in var)
            //    {
            //        if (purviews == null || purviews.Where(n => n.CMREF == p.CMREF).Count() < 1)
            //            continue;

         
              url = "Query/ChangeBillQuery.aspx";

            //在页面上生成功能节点
            strNavigation.Append("<div class='list_menu_list'>");
            strNavigation.Append("<img src=../Images/bullet_blue_small.png class=box />");
            strNavigation.Append("<a onclick='setURL(this)' class='TreeNode' target='" + target + "' href = " + (Request.ApplicationPath == "/" ? "" : Request.ApplicationPath) + "/" + url + " tag = ''>换单查询</a>");
            strNavigation.Append("</div>");

            //        tblNavigation.Rows.Add(new object[] { Request.Url.ToString().Substring(0, Request.Url.ToString().LastIndexOf(Request.ApplicationPath) + Request.ApplicationPath.Length + 1) + p.URL, query.PMODULENM + " - " + p.MODULENM });
            //    }
            strNavigation.Append("</div>");
            strNavigation.Append("</div>");
        }

        
    }


    //private bool IsAllHidden(List<CMODULE> lst, List<ROLEPURVIEW> purviews)
    //{
    //    foreach (CMODULE p in lst)
    //    {
    //        if (purviews != null)
    //        {
    //            if (purviews.Where(n => n.CMREF == p.CMREF).Count() > 0)
    //                return false;
    //        }
    //    }
    //    return true;
    //}

}
